/* 
 * Copyright [2018] [Alex/libo(liboms@hotmail.com)]
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.hyts.parser.parse;

import com.hyts.parser.bean.ParseRequestBean;
import com.hyts.parser.bean.ParserResultBean;
import com.hyts.parser.build.BaseParserBuilder;
import com.hyts.parser.config.ParseContentUnit;

/** 
 * @title DocParser.java  
 * @package com.hyts.parser.parse  
 * @description TODO  
 * @see TODO
 * @author libo/Alex
 * @email liboms@hotmail.com/liboware@163.com  
 * @date 2018年4月11日 
 * @version V1.0 
 */
public class DocParser {

	/**  
	 * <p>基础解析构建器</p> 
	 * @fieldName builder
	 * @fieldType BaseParserBuilder
	 */ 
	private BaseParserBuilder builder;
	/**  
	 * @constructor：DocParser  
	 * @param builder  
	 */ 
	public DocParser(BaseParserBuilder builder){
		this.builder = builder;
	}
	
	/**  
	 * <b>TODO(方法功能的描述)</b>
	 * <p>TODO(这里用一句话描述这个方法的作用)</p>
	 * @param filePath
	 * @return
	 * @exception
	 */ 
	public ParserResultBean parse(String filePath){
		try {
			return builder.parse(new ParseRequestBean(filePath));
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}
	
	/**  
	 * <b>TODO(方法功能的描述)</b>
	 * <p>TODO(这里用一句话描述这个方法的作用)</p>
	 * @param filePath
	 * @param maxContentSize
	 * @param unit
	 * @return
	 * @exception
	 */ 
	public ParserResultBean parse(String filePath,int maxContentSize,ParseContentUnit unit){
		try {
			return builder.parse(new ParseRequestBean(filePath,maxContentSize,unit));
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}
}
